﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ALDIOrganizer
{
    public partial class SelectTemplates : Form
    {
        public SelectTemplates()
        {
            InitializeComponent();
        }

        public List<string> GetUserChoice
        {
            get
            {
                var _result = new List<string>();
                foreach (var _item in lbxChoices.SelectedItems)
                {
                    _result.Add(_item.ToString());
                }
                return _result;
            }
        }

        public SelectTemplates(
            string pWindowTitle,
            string pMessage,
            List<string> pChoices,
            bool pAutoSelectAll) : this()
        {   
            this.Text = pWindowTitle;
            this.lblText.Text = pMessage;
            lbxChoices.DataSource = pChoices;
            if (pAutoSelectAll)
            {
                btnSelectAll_Click(null, null);
            }
        }

        private void btnSelectAll_Click(object sender, EventArgs e)
        {
            for (int _index = 0; _index < lbxChoices.Items.Count; _index++)
            {
                lbxChoices.SetSelected(_index, true);
            }
        }
    }
}
